package com.iotp.service.leave_message;

import com.iotp.dao.leave_message.LeaveMessageMapper;
import com.iotp.entity.leave_message.LeaveMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("leaveMessageService")
public class LeaveMessageServiceImpl implements LeaveMessageService {
    @Autowired
    private LeaveMessageMapper leaveMessageMapper;
    @Override
    public Long add(LeaveMessage leaveMessage) {
        this.leaveMessageMapper.insert(leaveMessage);
        return leaveMessage.getId();
    }

    @Override
    public void update(LeaveMessage leaveMessage) {
        this.leaveMessageMapper.updateByPrimaryKeySelective(leaveMessage);
    }

    @Override
    public void delete(Long id) {
        this.leaveMessageMapper.deleteByPrimaryKey(id);
    }

    @Override
    public LeaveMessage queryById(Long id) {
        return this.leaveMessageMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<LeaveMessage> queryList(LeaveMessage leaveMessage) {
        return this.leaveMessageMapper.selectByCondition(leaveMessage);
    }
}
